package com.mmall.concurrency.example.singleton;

import lombok.extern.slf4j.Slf4j;

/**
 * 懒汉模式 运行的时候才被创建
 */
@Slf4j
public class SingletonExample3 {
    private SingletonExample3(){
    }

    private  static SingletonExample3 instance=null;

    public static synchronized  SingletonExample3 getInstance(){
        if(instance==null){
            instance=new SingletonExample3();
        }
        return instance;
    }
}
